/*
 * KjcgNeedProcessAction.java
 *
 * Created on 2011��2��11��, ����3:01
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package orest.back.achieve;
import  orest.common.valueobject.KjcgNeedProcessVal;
import  orest.common.dao.KjcgNeedProcessDao;
import  orest.common.response.Response;
import  orest.common.util.Tools;
import java.util.ArrayList;
import java.util.Iterator;
/**
 *
 * @author guoxin
 */
public class KjcgNeedProcessAction {
    
    /** Creates a new instance of KjcgNeedProcessAction */
    public KjcgNeedProcessAction() {
    }
    
    public String  findKjcgNeedProcessByNeedID(String id){
       Response            rp       = new Response();
        StringBuffer        result   = new StringBuffer();
        KjcgNeedProcessDao      obj      = new KjcgNeedProcessDao();
        Tools               tool     = new Tools();
        
        boolean            opReturn = true;
        String              temp     = "";
        opReturn = obj.findKjcgNeedProcessByNeedID(rp,id);
        if(!opReturn)
        return null;
        
        ArrayList al = rp.getValObjs ();
         result.append ("<?xml version='1.0' encoding='GBK'?>");
        result.append ("<root>");
        Iterator iterator = al.iterator();
        try{
            while(iterator.hasNext ()){
                KjcgNeedProcessVal objElem = (KjcgNeedProcessVal)iterator.next();
                
                result.append("<record>");
                result.append ("<ID>");
                result.append (objElem.getID());
                result.append ("</ID>");
               
               
                result.append ("<UserID>");
                result.append (objElem.getUserID());
                result.append ("</UserID>");
                
                result.append ("<Content>");
                result.append (objElem.getContent());
              
                result.append ("</Content>");
                result.append("</record>");
                
                objElem = null;
            }
        }
        catch(Exception e) {
            System.out.println ("when encoding the string, exception occured.");
            System.out.println ("The class is DetailExpertNAction and the function is " +
                                 "getExpertKjcg");
        }
        
        al = null;
        obj = null;
        rp = null;
        tool = null;
        result.append ("</root>");
        return result.toString();
  }
    
}
